﻿package main

import (
    "fmt"
    "strings"
)

func makeSuffixFunc(suffix string) func(string) string {
    return func(name string) string {
        if !strings.HasSuffix(name, suffix){
            return name + suffix
        }
        return name
    }
}

func main(){
    f1 := makeSuffixFunc(".bmp")
    f2 := makeSuffixFunc(".jpg")
    fmt.Println(f1("test1"))
    fmt.Println(f2("test2"))
    fmt.Println(f1("test3.bmp"))
}